Selecting elements topic

A selection is a set of elements from the DOM. Typically these elements are identified by selectors such as .fancy for elements with the class fancy, or div to select DIV elements.

Selection methods come in two forms, select and selectAll: the former selects only the first matching element, while the latter selects all matching elements in document order. The top-level selection methods, d4.select and d4.selectAll, query the entire document; the subselection methods, selection.select and selection.selectAll, restrict selection to descendants of the selected elements. There is also selection.selectChild and selection.selectChildren for direct children.

d4
    .select("body".u21)
    .append("svg".u22)
    .attrSet("width", 960.toString().u22)
    .attrSet("height", 500.toString().u22)
    .append("g".u22)
    .attrSet("transform", "translate(20,20)".u22)
    .append("rect".u22)
    .attrSet("width", 920.toString().u22)
    .attrSet("height", 460.toString().u22);

Functions

matcher(String selector) bool Function(Element, [JSAny?, int?, List<Element?>?]) Selecting elements
Given the specified selector, returns a function which returns true if this element matches the specified selector.
matcher(String selector) bool Function(Element, [JSAny?, int?, List<Element?>?]) Selecting elements
Given the specified selector, returns a function which returns true if this element matches the specified selector.
matcher(String selector) bool Function(Element, [JSAny?, int?, List<Element?>?]) Selecting elements
Given the specified selector, returns a function which returns true if this element matches the specified selector.
select([Union2<String, Element>? selector]) Selection Selecting elements
Selects the first element that matches the specified selector string.
select([Union2<String, Element>? selector]) Selection Selecting elements
Selects the first element that matches the specified selector string.
select([Union2<String, Element>? selector]) Selection Selecting elements
Selects the first element that matches the specified selector string.
selectAll([Union3<String, Iterable<Element?>, Object>? selector]) Selection Selecting elements
Selects all elements that match the specified selector string.
selectAll([Union3<String, Iterable<Element?>, Object>? selector]) Selection Selecting elements
Selects all elements that match the specified selector string.
selectAll([Union3<String, Iterable<Element?>, Object>? selector]) Selection Selecting elements
Selects all elements that match the specified selector string.
selection() Selection Selecting elements
Selects the root element, document.documentElement.]
selection() Selection Selecting elements
Selects the root element, document.documentElement.]
selection() Selection Selecting elements
Selects the root element, document.documentElement.]
selector([String? selector]) → Element? Function(Element, [JSAny?, int?, List<Element?>?]) Selecting elements
Given the specified selector, returns a function which returns the first descendant of this element that matches the specified selector.
selector([String? selector]) → Element? Function(Element, [JSAny?, int?, List<Element?>?]) Selecting elements
Given the specified selector, returns a function which returns the first descendant of this element that matches the specified selector.
selector([String? selector]) → Element? Function(Element, [JSAny?, int?, List<Element?>?]) Selecting elements
Given the specified selector, returns a function which returns the first descendant of this element that matches the specified selector.
selectorAll([String? selector]) List<Element?> Function(Element, [JSAny?, int?, List<Element?>?]) Selecting elements
Given the specified selector, returns a function which returns all descendants of this element that match the specified selector.
selectorAll([String? selector]) List<Element?> Function(Element, [JSAny?, int?, List<Element?>?]) Selecting elements
Given the specified selector, returns a function which returns all descendants of this element that match the specified selector.
selectorAll([String? selector]) List<Element?> Function(Element, [JSAny?, int?, List<Element?>?]) Selecting elements
Given the specified selector, returns a function which returns all descendants of this element that match the specified selector.
style(Element? node, String name) String? Selecting elements
Returns the value of the style property with the specified name for the specified node.
style(Element? node, String name) String? Selecting elements
Returns the value of the style property with the specified name for the specified node.
style(Element? node, String name) String? Selecting elements
Returns the value of the style property with the specified name for the specified node.
window(EventTarget node) → Window Selecting elements
Returns the owner window for the specified node.
window(EventTarget node) → Window Selecting elements
Returns the owner window for the specified node.
window(EventTarget node) → Window Selecting elements
Returns the owner window for the specified node.